# Python write()和writelines()：向文件中写入数据
file = open("a.txt", "w")
file.write("写入一行新数据")
file.close()

print()

file = open("a.txt", "a")
file.write("\n写入一行新数据")
file.close()

print()

'''
file = open("a.txt", "w", buffering = 0) # ValueError: can't have unbuffered text I/O
file.write("写入一行新数据")
file.close()
'''

input = open("a.txt", "r")
output = open("b.txt", "w+")
output.writelines(input.readlines())
input.close()
output.close()
